import java.util.Map;

/**
 * @program: generatorSqlmapCustom
 * @description: 模板内容定义
 * @author: 顾小皓
 * @create: 2020-07-19 16:19
 **/
public class TemplatesEmus {
    public static String project = "io.gxh.modules";
    public static String author = "顾小皓";
    public static String datetime = "2020-09-25 12:00:00";
    public static String primaryKeyType = "Long";//主键类型 支持Long 和 String
    /**
     * 各个类的类路径
     */
    public static String AutoMapper = ".auto.dao";
    public static String BaseMapper = ".auto.dao";
    public static String AutoService = ".auto.service";
    public static String IService = ".auto.service";
    public static String ServiceImpl = ".auto.service.impl";
    /**
     * 模板文件路径
     */
    public static String AutoDaoTemplateUrl = "AutoDao.ftl";
    public static String AutoServiceTemplateUrl = "AutoService.ftl";
    public static String BaseMapperTemplateUrl = "BaseMapper.ftl";
    public static String IAutoServiceTemplateUrl = "IAutoService.ftl";
    public static String AutoServiceImplTemplateUrl = "AutoServiceImpl.ftl";
    /**
     * 文件生成路径
     */
    public static String projectPath = "src/"+project.replace(".","/");
    public static String IServicePath = TemplatesEmus.projectPath + AutoService.replace(".","/")+"/";
    public static String BaseMapperPath = TemplatesEmus.projectPath + BaseMapper.replace(".","/")+"/";
    public static String ServiceImplPath = TemplatesEmus.projectPath + ServiceImpl.replace(".","/")+"/";
    public static String AutoServicePath = TemplatesEmus.projectPath + AutoService.replace(".","/")+"/";
    public static String AutoMapperPath = TemplatesEmus.projectPath +AutoMapper.replace(".","/")+"/";

    /**
     * 加入公共参数
     * @param map
     */
    public static void addPubMsg(Map map){
        map.put("author",author);
        map.put("datetime",datetime);
        map.put("packageEnums",project+map.get("packageEnums"));
        map.put("project",project);
        map.put("importIService",IService);
        map.put("primaryKeyType",primaryKeyType);
        map.put("tableRemarks",map.get("tableRemarks")==null?"": map.get("tableRemarks"));
    }

    /**
     * 获取主键类型的包路径
     * @return
     */
    public static String getPrimaryKeyTypePath(){
        switch (primaryKeyType){
            case "String":
                return "java.lang.String";
            case "Long":
                return "java.lang.Long";
        }
        return "java.lang.String";
    }
}
